
// use the help of thiserror

use std::fs::{read_to_string};

#[derive(Debug, thiserror::Error)]
enum MyError {
    #[error("")]
    EnvVarNotFound(#[from] std::env::VarError),
    #[error("")]// #[error(transparent)]
    IOError(#[from] std::io::Error),
}

fn main() -> Result<(), MyError> {
    // println!("Hello, world!");
    let html = render()?;
    println!("{html}");
    Ok(())
}
// if not found the env var, we can use $env:MARKDOWN="hello_world.txt" to add 
fn render() -> Result<String, MyError> {
    let fp = std::env::var("MARKDOWN")?;
    let content = read_to_string(fp)?;
    Ok(content)
}
